package com.ruoyi.ymapp.user.controller;


import com.ruoyi.ymapp.user.utils.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.ymapp.user.service.IYmUserService;


/**
 * 用户信息管理Controller
 *
 * @author Lu.F
 * @date 2022-11-07
 */
@RestController
@RequestMapping("/ymapp/user")
@Api
@Slf4j
public class YmUserController extends BaseController {
    @Autowired
    private IYmUserService ymUserService;

    /**
     * 用户登录接口
     * @param uTell
     * @param uPwd
     * @return
     */
    @ApiOperation(value = "登录接口")
    @PostMapping("login")
    public JsonData login(@RequestParam(value = "utell") @ApiParam("手机号") String uTell, @RequestParam("upwd") @ApiParam("密码") String uPwd) {
        JsonData jsonData = ymUserService.selectYmUserList(uTell, uPwd);
        log.info("loginData:{}",jsonData);
        return jsonData;
    }

    /**
     * 用户注册接口
     * @param uTell
     * @param uPwd
     * @return
     */
    @ApiOperation(value = "注册接口")
    @PostMapping("register")
    public JsonData register(@RequestParam(value = "utell") @ApiParam("手机号") String uTell, @RequestParam("upwd") @ApiParam("密码") String uPwd) {
        JsonData jsonData = ymUserService.insertYmUser(uTell, uPwd);
        log.info("loginData:{}",jsonData);
        return jsonData;
    }

}
